<?php

class UserAddressModel extends Model
{
    /*
     * 表单验证
     */
    protected  $_validate = array(
        array('province','checkProvince','请选择省份！',1,'callback',3),
        array('city','checkCity','请选择城市！',1,'callback',3),
        array('area','checkArea','请选择区域！',1,'callback',3),
        array('consignee','require','收货人姓名不能为空！',1,'regex',3),
        array('zipcode','require','邮政编码不能为空！',1,'regex',1),
        array('mobile','/^1[3|4|5|8][0-9]\d{4,8}$/','手机号码错误！',0,'regex',3),
    );

    protected function checkProvince()
    {
        if (empty($_POST['province'])) {
            return false;
        } else {
            return true;
        }
    }

    protected function checkCity()
    {
        if (empty($_POST['city'])) {
            return false;
        } else {
            return true;
        }
    }

    protected function checkArea()
    {
        if (empty($_POST['area'])) {
            return false;
        } else {
            return true;
        }
    }
}